package com.atguigu.gulimall.search.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author guoch0613@163.com
 * @Description
 * @create 2021-03-31 17:34
 */
@Configuration
public class MyRedissonConfig {

    @Bean(destroyMethod = "shutdown")
    public RedissonClient redisson() {
        //创建配置
        Config config = new Config();
        config.useSingleServer().setAddress("redis://192.168.84.130:6379");
        //根据config创建出的redissonclient示例
        RedissonClient redisson = Redisson.create(config);
        return redisson;
    }
}
